package xddq

import (
	"fmt"
	"time"
	D "websocket_apn/define"
	"websocket_apn/log"
	"websocket_apn/proto"
)

//解析轮回秘境-千界战场的结果
func (xd *XdDriver) CheckDaoTuInfoData(info D.DaoTuInfo) {
	if info.Layer > 50000 {
		newLayer := info.Layer - 50000 + 1
		if info.Time.Before(time.Now()) {
			xd.waitForStartSendCmd()
			if info.ChallengeNum < 30 {
				log.Infof("道途试练-开始挑战第%+v关,剩余挑战次数%d", newLayer, 30-info.ChallengeNum)
				xd.Send(proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_PROFESSION_SYNC_BATTLE_BOSS, fmt.Sprintf("08 %s 10 02", proto.IntDataToHexStr(int64(info.Layer)+1))))
			} else {
				xd.StopTaskByID(proto.S_PROFESSION_SYNC_BATTLE_BOSS)
				info.Layer = 59
				log.Infof("道途试练-开始速战第%+v关", info.Layer+1)
				xd.Send(proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_PROFESSION_SYNC_BATTLE_BOSS, fmt.Sprintf("08 E9 86 03 10 01")))
			}
		}
	}
}
